//封装fetch
async function fetch_http(obj) {
	let {
		method,
		url,
		data
	} = obj

	if (data) {
		// 如果有data参数，此时直接设置
		res = await fetch(url, {
			method: method,
			headers: {
				'Content-Type': 'application/json',
				'Access-Control-Allow-Origin':'http://localhost:8080'
			},
			body: JSON.stringify(data)
		})
	} else {
		res = await fetch(url)
	}
	return res.json()
}